* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* 顶部横栏 */
.top-bar {
    height: 80px;
    width: 100%;
    background-color: #dee2e6;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    padding: 0 10px 4px 10px;
    box-sizing: border-box;
}

/* 左侧内容 */
.top-bar-left {
    display: flex;
    align-items: center;
    height: 100%;
}

.company-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.company-logo {
    font-size: 48px;
}

.company-name {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* 右侧内容 */
.top-bar-right {
    display: flex;
    align-items: flex-end;
    gap: 30px;
    height: 100%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 32px;
}

.user-name {
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.login-btn, .register-btn {
    padding: 10px 20px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-btn {
    background-color: #ffffff;
    color: #333;
}

.login-btn:hover {
    background-color: #f8f9fa;
}

.register-btn {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.register-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* 应用容器 */
.app-container {
    display: flex;
    height: calc(100vh - 120px);
    width: 100%;
}

/* 左侧工具栏 */
.sidebar {
    width: 300px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.new-topic-btn {
    width: 100%;
    padding: 10px 15px;
    background-color: #10a37f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-topic-btn:hover {
    background-color: #0d8a6c;
}

/* 话题分类 */
.topics-container {
    height: 300px;
    padding: 10px;
    overflow-y: auto;
}

.topic-category {
    margin-bottom: 20px;
}

.topic-category h3 {
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding: 0 10px;
}

/* 话题列表 */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.topic-item {
    padding: 12px;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.topic-item:hover {
    border-color: #10a37f;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.topic-item.active {
    background-color: #e6f7f3;
    border-color: #10a37f;
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.topic-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex: 1;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.topic-item:hover .topic-actions {
    opacity: 1;
}

.edit-topic-btn, .delete-topic-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.edit-topic-btn:hover {
    background-color: #e9ecef;
}

.delete-topic-btn:hover {
    background-color: #fee;
}

.topic-time {
    font-size: 12px;
    color: #6c757d;
}

/* 主聊天区域 */
.chat-container {
    flex: 1;
    background-color: white;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 2px;
    background-color: #10a37f;
    color: white;
    display: flex;
    align-items: center;
    gap: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.current-topic-title {
    font-size: 16px;
    font-weight: 500;
    opacity: 0.9;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-messages {
    height: 700px;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #fafafa;
}

.welcome-message {
    text-align: center;
    color: #666;
    margin-top: 50px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-content {
    background-color: #10a37f;
    color: white;
    border-bottom-right-radius: 4px;
    font-size: 20px;
}

.message.assistant .message-content {
    background-color: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    font-size: 20px;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 12px;
    background-color: white;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: #10a37f;
}

#user-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

#send-btn {
    padding: 12px 24px;
    background-color: #10a37f;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#send-btn:hover:not(:disabled) {
    background-color: #0d8a6c;
}

#send-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 加载动画 */
.loading {
    display: inline-block;
    padding: 8px 16px;
}

.loading span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #10a37f;
    border-radius: 50%;
    margin: 0 2px;
    animation: loading 1.4s infinite ease-in-out both;
}

.loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.modal-content button[type="submit"] {
    width: 100%;
    padding: 10px;
    background-color: #10a37f;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-content button[type="submit"]:hover {
    background-color: #0d8a6c;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .chat-container {
        height: calc(100vh - 200px);
    }
    
    .message {
        max-width: 90%;
    }
}